package com.atomscat.lottery.entity.db;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.AbstractAuditable;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;

@Setter
@Getter
@Entity(name = "t_user")
public class UserEntity extends Auditable<UserEntity, Long> implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Column(length = 8)
    private String title;

    @Column(length = 64)
    private String firstName;

    @Column(length = 64)
    private String lastName;

    @Column(unique = true, length = 64)
    private String loginId;

    @Column(length = 128)
    private String password;

    @OneToMany(fetch = FetchType.EAGER)
    private List<UserIdentityEntity> identities;

    @ManyToMany(fetch = FetchType.EAGER)
    private List<RoleEntity> roles;

}
